Read in data and get rid of first line
sea_ice_org <- read_csv("sea_ice.csv") %>%
clean_names()
##
## ── Column specification ────────────────────────────────────────────────────────
## cols(
## Year = col_double(),
## `#day` = col_double(),
## Vol = col_double()
## )
sea_ice_org$date <- paste(sea_ice_org$year, sea_ice_org$number_day, sep = "_")
sea_ice_year <- sea_ice_org %>%
group_by(year)
sea_ice_dates <- read_csv("sea_ice_dates.csv") %>%
mutate(date = lubridate::mdy(standard_date),
ice_volume = as.numeric(Vol)) %>%
as_tsibble(key = NULL, index = date) %>%
tsibble::fill_gaps()
##
## ── Column specification ────────────────────────────────────────────────────────
## cols(
## standard_date = col_character(),
## new_date = col_character(),
## Year = col_double(),
## `#day` = col_double(),
## Vol = col_double()
## )
sea_ice <- sea_ice_dates %>%
select(date, ice_volume)
Start to build an interactive something
sea_ice %>%
gg_season(year.labels=TRUE)+
theme_dark() +
scale_colour_gradient(low = "dodgerblue3", high="ivory")
## Plot variable not specified, automatically selected `y = ice_volume`
## Warning: Ignoring unknown parameters: year.labels
## Scale for 'colour' is already present. Adding another scale for 'colour',
## which will replace the existing scale.
## Warning: Removed 10 row(s) containing missing values (geom_path).
ice_month <- sea_ice %>%
index_by(yr_mo = ~yearmonth(.)) %>%
summarize(monthly_mean_ice = mean(ice_volume, na.rm = TRUE))
ggplot(data = ice_month, aes(x = yr_mo, y = monthly_mean_ice)) +
geom_line()
# Or break it up by month:
ice_month %>%
ggplot(aes(x = year(yr_mo), y = monthly_mean_ice)) +
geom_line() +
facet_wrap(~month(yr_mo, label = TRUE))
ice_annual <- sea_ice %>%
index_by(yearly = ~year(.)) %>%
summarize(annual_ice = mean(ice_volume, na.rm = TRUE))
ggplot(data = ice_annual, aes(x = yearly, y = annual_ice)) +
geom_line()
sea_ice %>%
ACF(ice_volume) %>%
autoplot()
ice_month %>%
ACF(monthly_mean_ice) %>%
autoplot()
ice_dec <- ice_month %>%
model(STL(monthly_mean_ice ~ season(window = Inf)))
components(ice_dec) %>% autoplot()
sea_ice %>%
gg_season(year.labels=TRUE)+
theme_minimal()
## Plot variable not specified, automatically selected `y = ice_volume`
## Warning: Ignoring unknown parameters: year.labels
## Warning: Removed 10 row(s) containing missing values (geom_path).
dark_ice <- sea_ice %>%
gg_season(year.labels=TRUE, continuous=TRUE)+
theme_dark() +
scale_color_gradient(low="dodgerblue3", high="ivory")
## Plot variable not specified, automatically selected `y = ice_volume`
## Warning: Ignoring unknown parameters: year.labels, continuous
## Scale for 'colour' is already present. Adding another scale for 'colour',
## which will replace the existing scale.
dark_ice
## Warning: Removed 10 row(s) containing missing values (geom_path).
ggplot(data = ice_annual, aes(x = yearly, y = annual_ice)) +
geom_line(color = "dodgerblue3", size = 1) +
theme_minimal() +
labs(x = "",
y = "Artic Sea Ice Volume (km^3)")
gg_season(sea_ice, col = hsv(0.5, .35, seq(.45,.90,length.out = 15340))) +
theme_minimal()+
geom_line()
## Plot variable not specified, automatically selected `y = ice_volume`
## Warning: Removed 10 row(s) containing missing values (geom_path).
## Warning: Removed 10 row(s) containing missing values (geom_path).
polar_season <-
gg_season(sea_ice, year.labels=FALSE, continuous=TRUE, polar = TRUE) +
theme_void()
## Plot variable not specified, automatically selected `y = ice_volume`
## Warning: Ignoring unknown parameters: year.labels, continuous
polar_season
arctic <- readJPEG("arctic.jpg")
polar_season_col <-
gg_season(sea_ice, year.labels=FALSE, continuous=TRUE, polar = TRUE, pal = pal_seegruen) +
theme_void() +
theme_void()
## Plot variable not specified, automatically selected `y = ice_volume`
## Warning: Ignoring unknown parameters: year.labels, continuous
topo_yr <- ggdraw() +
draw_image(arctic) +
draw_plot(polar_season_col)
topo_yr
ggsave("topo_yr.png", width = 10, height =8)
rainbow_yr <- ggdraw() +
draw_image(arctic) +
draw_plot(polar_season)
rainbow_yr
polar_color <-
gg_season(sea_ice, year.labels=FALSE, continuous=TRUE, polar = TRUE) +
theme_void()
## Plot variable not specified, automatically selected `y = ice_volume`
## Warning: Ignoring unknown parameters: year.labels, continuous
polar_color
ggsave("polar_color.png", width = 8, height =8)
color_yr <- ggdraw() +
draw_image(arctic) +
draw_plot(polar_color)
color_yr
plot.new()
lim <- par()
rasterImage(arctic, lim$usr[1], lim$usr[3], lim$usr[2], lim$usr[4])
par(new=TRUE)
plot(polar_season)
ggsave("color_yr.png", width = 8, height = 8)
gg_season(sea_ice, col=topo.colors(15340), year.labels=TRUE)
## Plot variable not specified, automatically selected `y = ice_volume`
## Warning: Ignoring unknown parameters: year.labels
## Warning: Removed 10 row(s) containing missing values (geom_path).